﻿using BoriPeter.FatSecret.Models;
using BoriPeter.FitnessJournal8.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BoriPeter.FatSecret.Converters
{
    public static class FoodEntriesGetMonthConverter
    {
        public static List<DailyEntry> Convert(this FoodEntriesGetMonthModel _inmodel)
        {
            List<DailyEntry> retList = new List<DailyEntry>();
            if (_inmodel.Days != null)
            {
                foreach (var item in _inmodel.Days)
                {
                    var element = new DailyEntry();
                    element.Date = item.DateInt.ConvertToDate();
                    element.CaloriesIntakeKcal = item.Calories;
                    element.FatGram = item.Fat;
                    element.ProteinGram = item.Protein;
                    element.CarbohydrateGram = item.Carbohydrate;

                    retList.Add(element);
                }
            }

            return retList;
        }
    }
}
